//
//  CustomView.swift
//  事件传递-demo
//
//  Created by zhaoguoteng on 2020/5/24.
//  Copyright © 2020 zhaoguoteng. All rights reserved.
//

import UIKit

class CustomView: UIView {

    @IBInspectable var name: String?
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesBegan(touches, with: event)
        
        print("######### touchesBegan \(type(of: self)) - \(tag) - \(name ?? "")")
    }

    override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        
        let view = super.hitTest(point, with: event)
        
        print("######### hitTest \(type(of: self)) - \(tag) - \(name ?? "") - hitTest view:\(view?.tag ?? -1)")

        return view
    }
    
    override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
        let inside = super.point(inside: point, with: event)
        
        print("######### point_inside \(type(of: self)) - \(tag) - \(name ?? "")")

        return inside
    }
}
